<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AlterTableArticleCategoryAddSort extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('article_category', function (Blueprint $table) {
            $table->unsignedInteger('sort')->default(1)->after("type")->comment('sort 排序');

            $table->unsignedInteger("supportNum")->default(0)->after("type")->comment("点赞数");
            $table->unsignedInteger("collectNum")->default(0)->after("type")->comment("收藏数");
            $table->unsignedInteger("forwardNum")->default(0)->after("type")->comment("转发数");
            $table->unsignedInteger("readNum")->default(0)->after("type")->comment("阅读数");
            $table->unsignedInteger("showNum")->default(0)->after("type")->comment("展示数");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('article_category', function (Blueprint $table) {
            $table->dropColumn(["sort", "supportNum", "collectNum", "forwardNum", "readNum", "showNum"]);
        });
    }
}
